package com.fh.ss.config;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @FileName : MyLoadBalance
 * @Description :
 * @Author : fh
 * @Date : 2020/11/19 9:58
 * @Version : 1.0.0
 */
@Configuration
public class MyLoadBalance {

    /**
     * 初始化负载均衡策略
     * @return
     */
    @Bean
    public IRule iRule(){
        //七种负载均衡规则 选择随机算法
        return new RandomRule();
        //选择轮询算法
        //return new RoundRobinRule();
    }
}
